<script setup>
import {ref} from "vue";
// 跑马灯
let text = ref('浪起来~~~~~~~~~~~~')
let time = null
let isDisabled = ref(false)
function wave() {
    isDisabled.value = !isDisabled.value
    time = setInterval(()=>{
        text.value = text.value.slice(1) + text.value.slice(0, 1);
    },200)
}
function stop() {
    isDisabled.value = !isDisabled.value
    clearInterval(time)
}
</script>

<template>
  <button @click="wave" :disabled="isDisabled">浪起来</button>
  <button @click="stop" :disabled="!isDisabled">风紧，扯呼~</button>
  <p>{{text}}</p>
</template>

<style scoped lang="less">

</style>